/*
 * @Author: 邵朋 
 * @Date: 2023-12-08 19:19:11
 * @LastEditors: 邵朋 
 * @LastEditTime: 2023-12-16 20:18:39
 * @FilePath: /YouDian/src/util/toast/toast.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

///纯信息toast
export function infoToast(title:string){

  
    console.log('toast--------------'+title+'-------------------')

    uni.showToast({
        title:title,
        duration:3000,
        postion:'center',
        icon:'none'

    });
}

///成功toast
export function successToast(title:string){

    uni.showToast({
        title:title,
        duration:3000,
        postion:'center',
        icon:'success'
    });
}

///失败toast
export function errorToast(title:string){

    uni.showToast({
        title:title,
        duration:3000,
        postion:'bottom',
        icon:'error'
    });
}

//loading框
export function showLoading(title:string){
    let msg = title;
    if(typeof title === 'undefined' || title == null || title === ''){
        msg = '加载中'
    }
    uni.showLoading({
        title:msg,
    });
}


//隐藏loading框
export function hideLoading(){
    uni.hideLoading();
}
//确认弹窗
export function showConfirmAlert(param:{
    title:string,
    msg:string,
    cancelText:string,
    confirmText:string,
    confirmCallback:Function
}){
    uni.showModal({
        title:param.title,
        content:param.msg,
        cancelText:param.cancelText,
        confirmText:param.confirmText,
        success:(res) =>{
            if(res.confirm){
                param.confirmCallback()
            }
        }
    })
}